package com.yingpai.fitness.dvp_2_0.main.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import cn.addapp.pickers.util.LogUtils;

/**
 * Created by ASUS on 2018/11/22.
 */

public class ReadJsonFileUtil {
    public static String toString(InputStream is, String charset) {
        StringBuilder sb = new StringBuilder();

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(is, charset));

            while(true) {
                String line = reader.readLine();
                if(line == null) {
                    reader.close();
                    is.close();
                    break;
                }

                sb.append(line).append("\n");
            }
        } catch (IOException var5) {
            LogUtils.error(var5);
        }

        return sb.toString();
    }

    public static String toString(InputStream is) {
        return toString(is, "utf-8");
    }
}
